/*
 * Copyright (c) Huawei Technologies Co., Ltd. 2021-2022. All rights reserved.
 *
 */

import { ModuleTargetRes } from '../res/res-model.js';
import { ModuleTargetResImpl } from '../res/target-res-model-impl.js';

import { CoreSourceSetImpl } from './core-source-set-impl.js';
import { TargetSourceSetModel } from './source-set-model.js';

/**
 * module中每个target对应的一个sourceSet对象
 *
 */
export class TargetSourceSetImpl extends CoreSourceSetImpl implements TargetSourceSetModel {
  constructor(sourceSetRoot: string) {
    super(sourceSetRoot, new ModuleTargetResImpl(sourceSetRoot));
  }

  getModuleTargetRes(): ModuleTargetRes {
    return this.targetResModel as ModuleTargetResImpl;
  }

  getTargetSourceSetModuleName(): string | undefined {
    return this.getModuleTargetRes()?.getModuleJsonOpt()?.module?.name;
  }
}
